home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4891 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  54 lines

  1. Path: homer.louisville.edu!arwild01
  2. From: arwild01@homer.louisville.edu (Alan Wild)
  3. Newsgroups: comp.lang.c
  4. Subject: Help with pointer alignment
  5. Date: 7 Feb 1996 20:06:49 GMT
  6. Organization: University of Louisville, Louisville KY USA
  7. Message-ID: <4fb0op$8l8@hermes.louisville.edu>
  8. NNTP-Posting-Host: homer.louisville.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I am having a small problem with pointer alignment in a library I am
  12. developing. lint reports:
  13.  
  14. "queue.c", line 13: warning: possible pointer alignment problem, op CAST
  15.  
  16. And the code is as follows:
  17.  
  18. struct  dataChain {
  19.         ORD64           dataf;
  20.         ORD64           be;
  21.         int             cycle;
  22. struct  dataChain       *next;
  23. };
  24.  
  25. typedef struct dataChain queueentry;
  26.  
  27. void Append ( queueentry new, queue *Q ) {
  28.  
  29.         queueentry *temp = (queueentry *)malloc( sizeof( queueentry ) );
  30.  
  31.         temp->dataf = new.dataf;
  32.         temp->be= new.be;
  33.         temp->cycle = new.cycle;
  34.         temp->next = new.next;
  35.  
  36.         AppendData ( temp, Q );
  37. }
  38.  
  39. The line in error is the malloc statement.  What have I done
  40. wrong/dangerously?  I would like to correct this if at all possible.
  41. This is the only pententially problematic warning in my code and I would
  42. like to avoid any problems.  :)
  43.  
  44. Note:  I have checked through several books and the C FAQ, but I haven't
  45. seen anything.  My co-workers also did not have a clue about this one.
  46.  
  47. I am developing on anIBM rs6000 running AIX 3.2.5.  I am using the
  48. native version of lint.
  49.  
  50. Thanks you,
  51.  
  52. -Alan Wild
  53.  
  54.